// Copyright 2016-2017 Confluent Inc., 2015-2016 Andreas Heider
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Derived from: rdkafka-dotnet, licensed under the 2-clause BSD License.
//
// Refer to LICENSE for more information.


namespace Confluent.Kafka
{
    /// <summary>
    ///     Encapsulates information describing a particular
    ///     member of a Kafka group.
    /// </summary>
    public class GroupMemberInfo
    {
        /// <summary>
        ///     Initializes a new GroupMemberInfo class instance.
        /// </summary>
        /// <param name="memberId">
        ///     The member id (generated by the broker).
        /// </param>
        /// <param name="clientId">
        ///     The client's client.id.
        /// </param>
        /// <param name="clientHost">
        ///     The client's hostname.
        /// </param>
        /// <param name="memberMetadata">
        ///     Gets the member metadata (binary). The format of this data depends on the protocol type.
        /// </param>
        /// <param name="memberAssignment">
        ///     Gets the member assignment (binary). The format of this data depends on the protocol type.
        /// </param>
        public GroupMemberInfo(string memberId, string clientId, string clientHost, byte[] memberMetadata, byte[] memberAssignment)
        {
            MemberId = memberId;
            ClientId = clientId;
            ClientHost = clientHost;
            MemberMetadata = memberMetadata;
            MemberAssignment = memberAssignment;
        }

        /// <summary>
        ///     Gets the member id (generated by broker).
        /// </summary>
        public string MemberId { get; }

        /// <summary>
        ///     Gets the client's client.id.
        /// </summary>
        public string ClientId { get; }

        /// <summary>
        ///     Gets the client's hostname.
        /// </summary>
        public string ClientHost { get; }

        // TODO: Think about what the object model might look like if we were to ever
        //       add functionality to interpret this byte[] data. Is the below API what
        //       we want? (probably I think)

        /// <summary>
        ///     Gets the member metadata (binary). The format of this data depends on the protocol type.
        /// </summary>
        public byte[] MemberMetadata { get; }

        /// <summary>
        ///     Gets the member assignment (binary). The format of this data depends on the protocol type.
        /// </summary>
        public byte[] MemberAssignment { get; }
    }
}
